//
//  JDMessageInputCell.swift
//  DragonWallet
//
//  Created by volantPig on 2024/3/4.
//

import UIKit

class JDMessageInputCell: UITableViewCell {

    var containerView: UIView?
    var inputTitle: UILabel?
    var inputTextView: UITextView?
    
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        self.contentView.backgroundColor = color("#F5F6F8")
        self.setupUIElements()
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }
    
    func setupUIElements() {
        self.containerView = UIView()
        self.contentView.addSubview(self.containerView!)
        self.containerView?.snp.makeConstraints({ make in
            make.left.equalTo(self.contentView).offset(12)
            make.right.equalTo(self.contentView).offset(-12)
            make.top.equalTo(self.contentView)
            make.bottom.equalTo(self.contentView).offset(-10)
//            make.height.equalTo(100)
        })
        self.containerView?.layer.cornerRadius = 8
        self.containerView?.clipsToBounds = true
        self.containerView?.backgroundColor = .white
    
        self.inputTitle = UILabel()
        self.containerView?.addSubview(self.inputTitle!)
        self.inputTitle?.snp.makeConstraints({ make in
            make.left.equalTo(self.containerView!).offset(12)
            make.top.equalTo(self.containerView!).offset(12)
            make.height.equalTo(21)
        })
        self.inputTitle?.text = "看板内容"
        self.inputTitle?.font = UIFont.systemFont(ofSize: 15, weight: .semibold)
        self.inputTitle?.textColor = color("#333333")
        
        self.inputTextView = UITextView()
        self.containerView?.addSubview(self.inputTextView!)
        self.inputTextView?.snp.makeConstraints({ make in
            make.left.equalTo(self.containerView!).offset(12)
            make.top.equalTo(self.inputTitle!.snp.bottom).offset(10)
            make.right.equalTo(self.containerView!).offset(-12)
            make.bottom.equalTo(self.containerView!).offset(-10)
//            make.height.lessThanOrEqualTo(108)
            make.height.equalTo(108)
        })
        self.inputTextView?.placeholder = "请输入推送内容"
    }
    

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }

}
